package org.agile2soft.nexoma.core.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "CITIZEN")
@SuppressWarnings({"serial"})
public class User implements java.io.Serializable {

    private String documentNumber;
    private boolean document;
    private String password;
    private String name;
    private String surname1;
    private String surname2;
    private Integer telephone1;
    private Integer telephone2;
    private Integer fax;
    private String email;
    private boolean status;
    private Date birthDate;
    private Date activeDate;
    private String address;
    private String town;
    private String province;
    private String nationality;
    private boolean attemptsNumber;
    private boolean emailNotification;
    private Set<UserRequest> userRequests = new HashSet<UserRequest>(0);

    public User() {
    }

    public User(String documentNumber, boolean document,
            String password, String name, String surname1,
            boolean status, Date activeDate, boolean attemptsNumber,
            boolean emailNotification) {
        this.documentNumber = documentNumber;
        this.document = document;
        this.password = password;
        this.name = name;
        this.surname1 = surname1;
        this.status = status;
        this.activeDate = activeDate;
        this.attemptsNumber = attemptsNumber;
        this.emailNotification = emailNotification;
    }

    public User(String documentNumber, boolean document,
            String password, String name, String surname1,
            String surname2, Integer telephone1, Integer telephone2,
            Integer fax, String email, boolean status,
            Date birthDate, Date activeDate, String address,
            String town, String province, String nationality,
            boolean attemptsNumber, boolean emailNotification,
            Set<UserRequest> userRequests) {
        this.documentNumber = documentNumber;
        this.document = document;
        this.password = password;
        this.name = name;
        this.surname1 = surname1;
        this.surname2 = surname2;
        this.telephone1 = telephone1;
        this.telephone2 = telephone2;
        this.fax = fax;
        this.email = email;
        this.status = status;
        this.birthDate = birthDate;
        this.activeDate = activeDate;
        this.address = address;
        this.town = town;
        this.province = province;
        this.nationality = nationality;
        this.attemptsNumber = attemptsNumber;
        this.emailNotification = emailNotification;
        this.userRequests = userRequests;
    }

    @Id
    @Column(name = "CIU_DOCUMENT_NUMBER", unique = true, nullable = false, length = 25)
    public String getDocumentNumber() {
        return this.documentNumber;
    }

    public void setDocumentNumber(String documentNumber) {
        this.documentNumber = documentNumber;
    }

    @Column(name = "CIU_DOCUMENT", nullable = false)
    public boolean isDocument() {
        return this.document;
    }

    public void setDocument(boolean doucment) {
        this.document = doucment;
    }

    @Column(name = "CIU_PASSWORD", nullable = false, length = 15)
    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name = "CIU_NAME", nullable = false, length = 30)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "CIU_SURNAME1", nullable = false, length = 50)
    public String getSurname1() {
        return this.surname1;
    }

    public void setSurname1(String surname1) {
        this.surname1 = surname1;
    }

    @Column(name = "CIU_SURNAME2", length = 50)
    public String getSurname2() {
        return this.surname2;
    }

    public void setSurname2(String surname2) {
        this.surname2 = surname2;
    }

    @Column(name = "CIU_TELEPHONE1")
    public Integer getTelephone1() {
        return this.telephone1;
    }

    public void setTelephone1(Integer telephone1) {
        this.telephone1 = telephone1;
    }

    @Column(name = "CIU_TELEPHONE2")
    public Integer getTelephone2() {
        return this.telephone2;
    }

    public void setTelephone2(Integer telephone2) {
        this.telephone2 = telephone2;
    }

    @Column(name = "CIU_FAX")
    public Integer getFax() {
        return this.fax;
    }

    public void setFax(Integer fax) {
        this.fax = fax;
    }

    @Column(name = "CIU_EMAIL", length = 50)
    public String getEmail() {
        return this.email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(name = "CIU_STATUS", nullable = false)
    public boolean isStatus() {
        return this.status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CIU_BIRTH_DATE", length = 10)
    public Date getBirthDate() {
        return this.birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "CIU_ACTIVE_DATE", nullable = false, length = 10)
    public Date getActiveDate() {
        return this.activeDate;
    }

    public void setActiveDate(Date activeDate) {
        this.activeDate = activeDate;
    }

    @Column(name = "CIU_ADDRESS", length = 250)
    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Column(name = "CIU_TOWN", length = 50)
    public String getTown() {
        return this.town;
    }

    public void setTown(String town) {
        this.town = town;
    }

    @Column(name = "CIU_PROVINCE", length = 50)
    public String getProvince() {
        return this.province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    @Column(name = "CIU_NATIONALITY", length = 50)
    public String getNationality() {
        return this.nationality;
    }

    public void setNationality(String nationality) {
        this.nationality = nationality;
    }

    @Column(name = "CIU_NUMERO_INTENTOS", nullable = false)
    public boolean isAttemptsNumber() {
        return this.attemptsNumber;
    }

    public void setAttemptsNumber(boolean attemptsNumber) {
        this.attemptsNumber = attemptsNumber;
    }

    @Column(name = "CIU_NOTIFICACION_MAIL", nullable = false)
    public boolean isEmailNotification() {
        return this.emailNotification;
    }

    public void setEmailNotification(boolean emailNotification) {
        this.emailNotification = emailNotification;
    }


    @OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
    public Set<UserRequest> getUserRequests() {
        return this.userRequests;
    }

    public void setUserRequests(Set<UserRequest> userRequests) {
        this.userRequests = userRequests;
    }

}
